<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <th:block th:insert="/common/fragment :: icon"></th:block>
    <title>注册</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head>

<body>
<br>
<br>
<br>
<div class="m-container-small m-padded-tb-massive" style="max-width: 26em !important;">
    <div class="ui container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui teal image header">博客管理-注册</h2>
                <form action="#" method="post" class="ui form" th:action="@{/admin/register/submit}">
                    <div class="ui stacked segment">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user circle blue icon"></i>
                                <input type="text" name="nickname" placeholder="昵称">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user blue icon"></i>
                                <input type="text" name="username" placeholder="用户名">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="send blue icon"></i>
                                <input type="email" name="email" placeholder="邮箱">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock blue icon"></i>
                                <input type="password" name="password" placeholder="密码">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock blue icon"></i>
                                <input type="password" name="password_again" placeholder="再次输入密码">
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left input">
                                <input type="text" name="captcha" placeholder="验证码">
                                <p>
                                    <img id="captcha" src="/admin/captcha" alt="验证码" width="130px" height="48px">
                                </p>
                            </div>
                        </div>
                        <button class="ui fluid large teal submit button">
                            确&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;定
                        </button>
                    </div>

                    <div class="ui error mini message"></div>
                    <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}"></div>

                </form>

                <div class="ui message">
                    <span>已注册？请快点击>>></span><a href="#" th:href="@{/admin}">登录</a>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>

<script>
    /*验证码点击刷新*/

    //表单验证
    $('.ui.form').form({
        fields : {
            nickname : {
                identifier: 'nickname',
                rules: [{
                    type: 'empty',
                    prompt: '昵称不能为空！'
                }]
            },
            username : {
                identifier: 'username',
                rules: [{
                    type: 'empty',
                    prompt: '用户名不能为空！'
                }]
            },
            email : {
                identifier: 'email',
                rules: [{
                    type: 'empty',
                    prompt: '邮箱不能为空！'
                }]
            },
            password : {
                identifier: 'password',
                rules: [{
                    type: 'empty',
                    prompt: '密码不能为空！'
                }]
            },
            password_again : {
                identifier: 'password_again',
                rules: [{
                    type: 'empty',
                    prompt: '重复输入密码不能为空!'
                }]
            },
            captcha : {
                identifier: 'captcha',
                rules: [{
                    type: 'empty',
                    prompt: '验证码不能为空！'
                }]
            }
        }
    })
</script>
</body>

</html>